layui.use(['table', 'jquery', 'layer'], function () {
    var table = layui.table,
        layer = layui.layer,
        $ = layui.jquery;

    var tableIns = table.render({
        elem: "#supplierMaterialList",
        height: 'full-125',
        url: ctx + '/supplier/materialBySupplier?supplierId=' + $("input[name='id'] ").val(),
        page: true,
        cellMinWidth: 95, // 单元格最小宽度
        toolbar: '#toolbarDemo',
        cols: [[
            {type: 'checkbox'},
            {type: "numbers"},
            {
                title: "物料编码" ,templet:function (data){
                    return data.materialBean.materialNo;
                }
            },
            {
                title: "物料名称", templet: function (data) {
                    return data.materialBean.materialName;
                }
            },
            {
                title: "物料单位", templet: function (data) {
                    return data.materialBean.materialUnit;
                }
            },
            {
                title: "操作人", templet: function (data) {
                    return data.materialBean.empBean.empName;
                }
            },
            {
                title: "创建时间", templet: function (data) {
                    return data.materialBean.materialCreateDate;
                }
            },
        ]]
    })

    table.on('toolbar(supplierMaterialFilter)', function (data) {

        if (data.event == "add") {
            layer.open({
                type: 2,
                title: "供应商---修改供应商",
                content: ctx + "/supplier/toAddMaterBySupplier?supplierId=" + $("input[name='id'] ").val(),
                area: ['700px', '500px'],
                shadeClose: true,
                maxmin: true
            })
        }
    })

})